<%@ page import="myapp.User" %>



<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'client', 'error')} required">
	<label for="client">
		<g:message code="user.client.label" default="Client" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="client" name="client.id" from="${myapp.Client.list()}" optionKey="id" required="" value="${userInstance?.client?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'devices', 'error')} ">
	<label for="devices">
		<g:message code="user.devices.label" default="Devices" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${userInstance?.devices?}" var="d">
    <li><g:link controller="device" action="show" id="${d.id}">${d?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="device" action="create" params="['user.id': userInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'device.label', default: 'Device')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'name', 'error')} ">
	<label for="name">
		<g:message code="user.name.label" default="Name" />
		
	</label>
	<g:textField name="name" value="${userInstance?.name}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'password', 'error')} ">
	<label for="password">
		<g:message code="user.password.label" default="Password" />
		
	</label>
	<g:textField name="password" value="${userInstance?.password}"/>
</div>

